#pragma once 

#include "Widget.h"
#include "Types.h"

namespace My {

#pragma warning(push)
// Disable warning about inheritance via dominance
#pragma warning(disable:4250)

class LabelledWidget : public virtual Widget, public virtual Container
{
public:
	enum Layout { CaptionLeft, CaptionRight };
private:
	Widget *	m_pWidget;
	String		m_Caption;
	Layout		m_Layout;
	int			m_Alignment;
	int			m_Gap;
	CRect		m_TextRect;
public:
	LabelledWidget();
public:
	Widget * GetWidget() const
		{ return m_pWidget; }
	const String & GetCaption() const
		{ return m_Caption; }
	Layout GetLayout() const
		{ return m_Layout; }
	int GetAlignment() const
		{ return m_Alignment; }
	int GetGap() const
		{ return m_Gap; }
	void SetGap(int);
public:
	void SetWidget(Widget * pWidget);
	void SetCaption(const String & s);
	void SetLayout(Layout l);
	void SetAlignment(int a);
public:
	// handlers
	virtual void LayoutControls();
	virtual CSize GetPreferredSize() const;
	virtual void HandlePaint(CDC * pDC, const CRect & r);
	virtual void HandleFont();
	virtual void HandleUpdateUI();
};

#pragma warning(pop)

} // My
